Skip to content

fix: Allow None in enum properties [#504, #512]. Thanks @juspence! #516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 17, 2021

Conversation

dbanty
Copy link
Collaborator

@dbanty dbanty commented Oct 17, 2021

Based on #512, fixes #504.

juspence and others added 3 commits October 16, 2021 20:15
Needed for some OpenAPI schemas generated by django-rest-framework / drf-spectacular.
For enums which only allow None, add new null_enum.py.jinja template
For enums with mixed values, add logic to remove None from list
Mark enum property as nullable if None isn't the only value
Add tests for enums with mixed values and only null values
TODO: Make the type checker stop failing, but PTO next week
@dbanty dbanty added this to the 0.10.6 milestone Oct 17, 2021
@codecov
Copy link

codecov bot commented Oct 17, 2021

Codecov Report

Merging #516 (60b5ac9) into main (2f82310) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #516   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           48        48           
  Lines         1628      1636    +8     
=========================================
+ Hits          1628      1636    +8     
Impacted Files Coverage Δ
...i_python_client/parser/properties/enum_property.py 100.00% <ø> (ø)
...penapi_python_client/parser/properties/__init__.py 100.00% <100.00%> (ø)
...on_client/schema/openapi_schema_pydantic/schema.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2f82310...60b5ac9. Read the comment docs.

@dbanty dbanty merged commit 6e9d81f into main Oct 17, 2021
@dbanty dbanty deleted the juspence/main branch October 17, 2021 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support None / null as enum values
2 participants